import { map, showAirSpaceVolume } from "@/core";
import { Airspace } from "@/core/MapElement/Airspace";
import { getGUI } from "@/global/menu";
import GUI from "lil-gui";
import airspacedata from "../assets/airspace.json";

const airspaces = airspacedata.map(e => map.elements.get(e.name) as Airspace)



export function main() {
  const gui = getGUI('空域')
  const menu: any = {}
  let folder:GUI
  airspaces.forEach(e => {
    menu[e.option.name] = () => {
      folder?.destroy()
      folder=gui.addFolder(e.option.name)
      folder.add(e,'show')
      folder.add(e,'risk',[0,1,2,3])
      folder.add({
        显示剖面(){
          showAirSpaceVolume(e.option.name)
        }
      },'显示剖面')
      e.focus()
    }
    gui.add(menu,e.option.name)
  })
}
